<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@include file="../../inner/head.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<link type="text/css" rel="stylesheet" href="${basepath}/res/images/style.css" />
<style type="text/css">
body {
	margin:0px;
	padding:0px;
	height: 100%;
	width: 100%;
}
</style>
<script>
	function add(){
		if(!$("#name").val()){
			alert("Please enter your name！");
			$("#name").focus();
			return false;
		}
		if(!$("#email").val()){
			alert("Please enter email！");
			$("#email").focus();
			return false;
		}
		if(!$("#vcode").val()){
			alert("Please enter Validation Code！");
			$("#vcode").focus();
			return false;
		}
		var url="${basepath}/online?m=add";
		var options = {
			url: url,
			type: 'post',
			dataType: 'json',
			success: function(data){
				if(data!=null){
					alert(data.msg);
					document.getElementById("vimg").src="${basepath }/vcode?"+new Date();
				}else{
					alert("Message success!");
					onlineform.reset();
					top.location.href="${basepath}/index.jsp";
	            }
			}
		};
		$("#onlineform").ajaxSubmit(options);
	}
	
</script>
<body>
<form id="onlineform" name="onlineform">
  	<div id="list_r">
	  <div style="background-color: #e8e8e8;margin:0px 30px 100px 30px;border:1px solid #aeaeae;">
		<div style="line-height:48px;font-size:22px;font-weight: bold;font-family: '黑体';text-align: left;margin-left: 5px;background:url('${basepath}/res/images/online.png') no-repeat;" ><b style="margin-left: 70px">Signed written message</b></div>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin: 30px auto 30px;">
			<tr>
				<td height="50" width="15%" align="right">You Name：</td>
        		<td align="left" width="30%">&nbsp;<input id="name" name="name" title="You Name"><font color="red">&nbsp;*</font></td>
				<td height="50" width="10%" align="right" rowspan="4">CONTENT：</td>
        		<td align="left" rowspan="4">&nbsp;<textarea id="content" name="content" rows="8" cols="30" style="margin-top: 5px;margin-bottom: 5px;" title="CONTENT"></textarea></td>
			</tr>
			<tr>
				<td height="50" align="right">Email：</td>
        		<td align="left">&nbsp;<input id="email" name="email" title="Email"><font color="red">&nbsp;*</font></td>
			</tr>
			<tr>
				<td height="50" align="right">ICQ/MSN：</td>
        		<td align="left">&nbsp;<input id="msn" name="msn" title="ICQ/MSN"></td>
			</tr>
			<tr>
				<td height="50" align="right">TEL：</td>
        		<td align="left">&nbsp;<input id="telphone" name="telphone" title="TEL"></td>
			</tr>
			<tr>
				<td height="50" align="center" colspan="4">Validation Code：<input name="vcode" id="vcode" type="text" onKeyPress="if(event.keyCode==13)add()" maxlength="4" style="width: 46px;height: 24px" />&nbsp;&nbsp;<img src="${basepath }/vcode" id="vimg" align="absmiddle" width="60" height="28" title="点击切换验证码" style="cursor: pointer;" onclick="this.src=this.src+'?random=new Date()'"  /><font color="red">&nbsp;*</font></td>
			</tr>
			<tr>
				<td height="50" colspan="4" align="center">
					<img src="${basepath}/res/image/submit.jpg" width="59" height="22" onclick="add();" title="提交" style="cursor: pointer;">
        	  		<img src="${basepath}/res/image/reset.jpg" width="59" height="22" onclick="onlineform.reset();" title="重置" style="cursor: pointer;">
				</td>
			</tr>
		</table>
	  </div>
	</div>
</form>
</body>
